package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.com.api.entity.ApiT_dianping;

//DAO
public interface T_dianpingMapperBase {

	// 根据id查看
	@Select("SELECT d.*,m.c_nick username FROM t_dianping d left join t_member m on d.c_userid = m.c_userid WHERE d.c_id = #{c_id}")
	public ApiT_dianping findT_dianpingBycId(Integer c_id);

	// 查看数据集
	@Select("SELECT * FROM T_dianping")
	public List<ApiT_dianping> findT_dianpings();

	// 添加
	@Insert("INSERT INTO t_dianping (c_sid, c_jid, c_dtype, c_fee, c_text, c_userid, c_ip, c_appdate, c_retext, c_redate, c_enable, c_adm, c_check, c_guest, c_goodsid, c_orderid, is_raise) VALUES (#{c_sid}, #{c_jid}, #{c_dtype}, #{c_fee}, #{c_text}, #{c_userid}, #{c_ip}, #{c_appdate}, #{c_retext}, #{c_redate}, #{c_enable}, #{c_adm}, #{c_check}, #{c_guest}, #{c_goodsid}, #{c_orderid}, #{is_raise})")
	@Options(useGeneratedKeys = true, keyProperty = "c_id")
	public int insertT_dianping(ApiT_dianping t_dianping);

	// 修改
	@Update("UPDATE t_dianping SET c_sid = #{c_sid}, c_jid = #{c_jid}, c_dtype = #{c_dtype}, c_fee = #{c_fee}, c_text = #{c_text}, c_userid = #{c_userid}, c_ip = #{c_ip}, c_appdate = #{c_appdate}, c_retext = #{c_retext}, c_redate = #{c_redate}, c_enable = #{c_enable}, c_adm = #{c_adm}, c_check = #{c_check}, c_guest = #{c_guest}, c_goodsid = #{c_goodsid}, c_orderid = #{c_orderid}, is_raise = #{is_raise} WHERE c_id = #{c_id}")
	public int updateT_dianping(ApiT_dianping t_dianping);

	// 删除
	@Delete("DELETE FROM t_dianping  WHERE c_id = #{c_id}")
	public int deleteT_dianping(Integer c_id);

}
